<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
	
	<h:head>
		<title>Giftlist dell'utente</title>
	</h:head>
    <h:body>
    	<h:form>
    		<h:link outcome="home" value="Torna alla home" />
    		<h:panelGrid columns="4" cellpadding="5">  
        		<h:outputLabel for="nome" value="Email utente:" style="font-weight:bold"/>  
          
        		<p:inputText id="name" value="#{giftlistBean.emailUser}" />  
          
        		<h:commandButton value="Cerca" update="error, display" action="#{giftlistBean.populateList()}" />    
    		</h:panelGrid>  
    		
    		
    		<h:panelGrid id="error">
    			<h:outputText id="errore" value="#{giftlistBean.errore}" />
    		</h:panelGrid>
    			
    			
	    	<p:panelGrid id="display" style="margin-top:20px">  
	    		<f:facet name="header">  
	        		<p:row>  
	           			<p:column colspan="7">GiftList Utente</p:column>
	           			<p:column colspan="7">Pacchetti in gift list selezionata</p:column>
	           			<p:column colspan="7">Prodotti base in gift list selezionata</p:column>
	        		</p:row>
	        	</f:facet>
	        	
	        		<p:row>
	        			<p:column colspan="7">
	        				<p:dataTable var="giftlist" value="#{giftlistBean.glsDTO}">  
        						<p:column headerText="Nome">
            						<h:commandButton value="#{giftlist.name}" action="#{giftlistBean.seleziona(giftlist.name)}" update="packs">
            						</h:commandButton>
		        				</p:column>
    						</p:dataTable>  
	        			</p:column>
	        			
	        			<p:column colspan="7">
	        				<p:dataTable id="packs" var="pacchetto" value="#{giftlistBean.gfSelezionata.pacchetti}">
	        					<p:column headerText="Nome">
	        						<h:outputText value="#{pacchetto.nome}" />
	        					</p:column>
	        				</p:dataTable>
	        			</p:column>
	        			
	        			<p:column colspan="7">
	        				<p:dataTable id="baseprods" var="pb" value="#{giftlistBean.gfSelezionata.prodottiBase}">
	        					<p:column headerText="Id">
	        						<h:outputText value="#{pb.id}" />
	        					</p:column>
	        				</p:dataTable>
	        			</p:column>
	        		</p:row>
	    	</p:panelGrid>
    	</h:form>
    </h:body>
</html>